// 引入封装好的角色列表接口
import {roleList} from '../../../request/api'
const state={
    roleList:[]
}

const getters = {
    getRoleList(state){
        return state.roleList
    }
}

const mutations = {
    ROLE_LIST(state,payload){
        state.roleList = payload
    }
}

const actions = {
    getRoleListAction({commit}){
        // 调用角色列表接口
        roleList()
        .then(res=>{
            console.log(res,'角色列表接口');
            commit('ROLE_LIST',res.list)
        })
    }
}

export default {
    state,
    getters,
    mutations,
    actions,
    // 命名空间
    namespaced:true
}